import axios from "axios";
import { showFullScreenLoading, tryHideFullScreenLoading } from "../api/servicesHelp";



const service = axios.create({
    baseURL:"http://localhost:3000",
    timeout:3000,
    headers:{
        
    }
});


service.interceptors.request.use(config=>{

    let token = localStorage.getItem("token");
    if(token){
        config.headers.authoraiztion = token;
    }
    
        showFullScreenLoading()
    
        
    

    return config;
},function (error) {
    // 请求错误的时候做些什么
    return Promise.reject(error);
});

service.interceptors.response.use(res=>{
    
        tryHideFullScreenLoading()
    
    return res;
},function (error) {
    // 对响应错误做点什么
    return Promise.reject(error);
});
  

export default service;